//
//  ViewController.m
//  SwipeViewDemo
//
//  Created by 如佳 陈 on 15/8/12.
//  Copyright (c) 2015年 crj. All rights reserved.
//

#import "ViewController.h"
#import "RJSwipeView.h"
#import "TestViewController.h"

@interface ViewController ()<RJSwipeViewDelegate>{
    bool flag;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"a" style:UIBarButtonItemStyleDone target:self action:@selector(test)];
    
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    for (int i = 0; i < 4; i++) {
        TestViewController *vc = [[TestViewController alloc]init];
        vc.view.backgroundColor = [UIColor lightGrayColor];
        vc.label.text = @(i+1).stringValue;
        [arr addObject:vc];
    }
    self.v.tagBarTintColor = [UIColor redColor];
    self.v.tagBarTextColor = [UIColor lightGrayColor];
//    self.v.topHeight = 44;
    [self.v setTitles:@[@"first",@"second",@"third",@"fourth"]];
    [self.v setViewControllers:arr];
    self.v.delegate = self;
}

- (void)test{
    UIViewController *vc = [[UIViewController alloc]init];
    vc.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)swipeView:(RJSwipeView *)swipeView didPresentViewController:(UIViewController *)viewController firstPresented:(BOOL)firstPresented{
    if (firstPresented) {
        NSLog(@"load %@",((TestViewController*)viewController).label.text);
    }
}

@end
